﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;

namespace Phong_CTSV
{
    public class Total_Data
    {
    
        
         public static Data_Table[] TotalValue (Data_Table[,] data, int numRow,int numCol)
        {
            Data_Table[] value = new Data_Table[numCol];
            for (int i =0 ; i < numCol;i++)
            {
                value[i] = new Data_Table();
                value[i].Value_type = data[0, i].Value_type;
                value[i].Value = data[0, i].Value;
                for (int j = 1; j < numRow; j++)
                {
                    if (value[i].Value_type.Equals("int"))
                    {
                        value[i].Value = (Int64.Parse(value[i].Value) + Int64.Parse(data[j, i].Value)).ToString();
                    }
                    else
                        if (value[i].Value_type.Equals("string"))
                            value[i].Value = value[i].Value + "\n" + data[j, i].Value;

                }
            }
            return value;
        }
      
    }
}